<?php

ini_set('display_errors', 1);
//必黑词， 验证码判断，退订关键字，模板匹配

$arrWord = array('您的验证码是', '保存好', '你', 'word3', 'a', 'ab', 'abc', 'b', "哈哈", "哈哈");

$resTrie = trie_filter_new(); //create an empty trie tree

//$i = 100000;
//while ($i--) {
//    
//}

foreach ($arrWord as $k => $v) {
    $data = $k;
    trie_filter_store($resTrie, $v, $tp_id);
//    trie_filter_delete($resTrie, $v, $tp_id);
}

//trie_filter_save($resTrie, __DIR__ . '/blackword.tree');
//
//$resTrie = trie_filter_load(__DIR__ . '/blackword.tree');

$str = '您的验证码是你哈哈word1 word4 word2';

$arrRet = trie_filter_search_all($resTrie, $str);

var_dump($arrRet); //Array(0 => 6, 1 => 5)


trie_filter_free($resTrie);

die;
